package com.jtcl;

import com.github.lianjiatech.retrofit.spring.boot.annotation.RetrofitScan;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.jms.annotation.EnableJms;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@SpringBootApplication
@MapperScan("com.jtcl.module")
@EnableKnife4j
@EnableJms
@RetrofitScan("com.jtcl.module.retrofit")
public class JtclDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(JtclDemoApplication.class, args);
    }

    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        Docket docket=new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("RESTful APIs")
                        .description("# com.jtcl RESTful APIs")
                        .termsOfServiceUrl("http://jtcl.tech:8848/nacos")
                        .contact(new Contact("jtcl","http://jtcl.tech:8848/nacos","shijinting0321@163.com"))
                        .version("0.0.1")
                        .build())
                //分组名称
                .groupName("0.0.1")
                .select()
                //这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("com.jtcl"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}
